# Contributor: Julian Weigt <juw@posteo.de>
# Maintainer: Julian Weigt <juw@posteo.de>
pkgname=asymptote
pkgver=2.65
pkgrel=0
pkgdesc="A vector graphics language for technical drawing"
url="http://asymptote.sourceforge.net/"
arch="all !mips64" # blocked by texlive
license="GPL-3.0-only"
depends="texlive texlive-dvi ghostscript"
### Optional dependencies
# gsl and gsl-dev for the support of certain special functions.
# fftw for fourier transform of data
# numpy pyqt5 cson and librsvg for GUI program xasy. I could not find cson for alpine though.
# freeglut for openGL support
makedepends="zlib-dev texinfo autoconf"
subpackages="$pkgname-doc"
source="https://downloads.sourceforge.net/sourceforge/asymptote/asymptote-$pkgver.src.tgz"

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	# Without specifying, the content of texmf goes to /texmf-dist in root dir
	# Build hangs without --disable-gc
	./configure \
		--prefix=/usr \
		--with-latex=/usr/share/texmf/tex/latex \
		--with-context=/usr/share/texmf/tex/context \
		--disable-gc
	make asy


	#-j1 is needed for building documentation with pdflatex due to probably race conditions
	make -j1 all
}

check() {
	### Other option:
	#make check-all. Fails without gsl and gsl-dev.
	make check
}

package() {
	### Other options
	#make install doesn't install html documentation
	make -j1 DESTDIR="$pkgdir" install-all
}

sha512sums="c6879689192c1646a318b389de222accc55c8d5e9df17fab3c88c37f627d2cff8133cdefe9e6dec2784cf72edf261e557ad83f7fac6e67fd49c483e9d8971026  asymptote-2.65.src.tgz"
